#include <iostream>
using namespace std;



int main(){
	int n;
	cin>>n;
	int a[n],sta[n],ans[n];
	for(int i=0;i<n;i++)
		scanf("%d",&a[i]);
	int p=-1;
	for(int i=n-1;i>=0;i--){
		while(p != -1  &&  a[sta[p]] <= a[i]) p--;
		if(p == -1)
			sta[++p] = i,ans[i] = 0;
		else
			sta[++p] = i,ans[i] = sta[p-1]+1;
	}
	for(int i=0;i<n;i++)
		printf("%d ",ans[i]);
	return 0;
}
